﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace msBsc.WebUi.mMall.Seller
{
    public partial class mfAgentDjackUserInfo : msBsc.Cls.mBPProxyDealer
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        //初始化用户信息
        private void getDjackInfo()
        {
            string djackId = msBsc.SvRef.UserInfo.Operator;
            if (string.IsNullOrEmpty(djackId))
            {
                return;
            }
            using (msBsc.AppLogic.DataAlc.CBizVehicleInfo vehicleInfo = new AppLogic.DataAlc.CBizVehicleInfo())
            {
                DataSet ds = vehicleInfo.SelectByIds(djackId, "");
                if (ds != null)
                {
                    string retJson = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", "", 1, 50, "");
                    this.ExecJScript(@"setDjackInfo(" + retJson + ")");
                }
            }

            //using (msBsc.AppLogic.DataAlc.CBizCustomerBaseInfo objCBizCustomerBaseInfo = new AppLogic.DataAlc.CBizCustomerBaseInfo())
            //{
            //    System.Data.DataSet ds = objCBizCustomerBaseInfo.SelectById(msBsc.SvRef.UserInfo.Operator);

            //    if (ds.Tables[0].Rows[0]["CUSTOMER_ALIPAY_ACCOUNT"] == System.DBNull.Value
            //        || string.IsNullOrEmpty(ds.Tables[0].Rows[0]["CUSTOMER_ALIPAY_ACCOUNT"].ToString()))
            //    {
            //        this.ExecJScript(@"SetUserAliAccount(""/ms_BindBalanceInfo.htm"",""支付宝绑定"")");
            //        //usrAccountStr = @"<li ><a class="""" href=""/ws_BindBalanceInfo.htm"">账户绑定</a></li>";
            //    }
            //    else if (ds.Tables[0].Rows[0]["CUSTOMER_IS_CREFY"] == System.DBNull.Value
            //        || ds.Tables[0].Rows[0]["CUSTOMER_CREFY_STATUS"] == System.DBNull.Value
            //        || System.Convert.ToInt32(ds.Tables[0].Rows[0]["CUSTOMER_CREFY_STATUS"]) != (int)msBsc.AppLogic.DataAlc.CrefEnum.PassCref)
            //    {
            //        this.ExecJScript(@"SetUserAliAccount(""/ms_CrecityfyAlipayAccount.htm"",""支付宝认证"")");
            //        //usrAccountStr = @"<li ><a class="""" href=""/ws_CrecityfyAlipayAccount.htm"">账户认证</a></li>";
            //    }
            //    else if (System.Convert.ToInt32(ds.Tables[0].Rows[0]["CUSTOMER_CREFY_STATUS"]) == (int)msBsc.AppLogic.DataAlc.CrefEnum.PassCref)
            //    {
            //        //this.ExecJScript(@"SetUserAliAccount(""/ms_ClearBalanceInfo.htm"",""支付宝解绑"")");
            //        //usrAccountStr = @"<li ><a class="""" href=""#"">账户解绑</a></li>";

            //    }
            //}
        }
        public override void DoAction()
        {
            if (this.strAction == "init")
            {
                getDjackInfo();
            }
        }
    }
}